'''
Genotype Use Case Tests

1) Create a genotype (confirm data)
2) Edit genotype

'''

from interactive import *

#1)

css("#ColonyView")
linkpart("EPO").click()
twait()

css("#ColonyMenu")
linkpart("Genotypes").click()
twait()

css("#GenotypeList")
New()
twait()

css("#GenotypeDetail")
css("#GenotypeDetail #Name").send_keys("N7")
css("#GenotypeDetail #Comment").send_keys("This is a new genotype to test from")
Done()
twait()

css("#GenotypeList")
linkpart("N7").click()
twait()

assert(css("#GenotypeDetail #Name").get_attribute("value") == "N7")
assert(css("#GenotypeDetail #Comment").get_attribute("value") == "This is a new genotype to test from")
twait()

#2)

Edit()
twait()
css("#GenotypeDetail")
css("#GenotypeDetail #Name").clear()
css("#GenotypeDetail #Name").send_keys("B4U")
css("#GenotypeDetail #Comment").clear()
css("#GenotypeDetail #Comment").send_keys("N7 has nothing on this genotype")
Done()
twait()

css("#GenotypeList")
linkpart("B4U").click()
twait()

assert(css("#GenotypeDetail #Name").get_attribute("value") == "B4U")
assert(css("#GenotypeDetail #Comment").get_attribute("value") == "N7 has nothing on this genotype")
twait()

driver.quit()
